package com.hupu.jrs.ui.setting

import android.content.Context
import android.content.Intent
import android.support.v7.widget.Toolbar
import butterknife.BindView
import butterknife.ButterKnife
import com.hupu.jrs.R
import com.hupu.jrs.injector.HasComponent
import com.hupu.jrs.ui.BaseSwipeBackActivity

/**
 * Created by sll on 2016/3/11.
 */
class SettingActivity : BaseSwipeBackActivity(), HasComponent<SettingComponent> {

    @BindView(R.id.toolbar)
    internal var toolbar: Toolbar? = null

    var component: SettingComponent? = null
        private set

    protected val isApplyStatusBarTranslucency: Boolean
        get() = false

    protected val isApplyStatusBarColor: Boolean
        get() = true

    fun initContentView(): Int {
        return R.layout.base_content_toolbar_layout
    }

    fun initInjector() {
        component = DaggerSettingComponent.builder()
                .applicationComponent(getApplicationComponent())
                .activityModule(getActivityModule())
                .build()
    }

    fun initUiAndListener() {
        ButterKnife.bind(this)
        initToolBar(toolbar)
        setTitle("设置")
        getFragmentManager().beginTransaction().replace(R.id.content, SettingFragment()).commit()
    }

    companion object {

        fun startActivity(mContext: Context) {
            val intent = Intent(mContext, SettingActivity::class.java)
            mContext.startActivity(intent)
        }
    }
}
